package cn.tk.model.entity.mr;

import cn.tk.model.entity.AbstractEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Table;
import java.util.Objects;

/**
 * Created by denglw on 2021/7/14.<br/>
 * Desc: 实体
 */
@Data @NoArgsConstructor
@javax.persistence.Entity
@Table(name = "mr_entity")
public class Entity extends AbstractEntity {

    /**
     * 唯一标识码
     */
    private String code;

    /**
     * 名称
     */
    private String name;

    /**
     * 类型：1系统实体  2场景实体
     */
    private Integer entityType;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Entity)) {
            return false;
        }
        Entity entity = (Entity) o;
        return Objects.equals(entity.getId(), getId())
                && Objects.equals(code, entity.code)
                && Objects.equals(name, entity.name)
                && Objects.equals(entityType, entity.entityType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), code, name, entityType);
    }
}
